import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            name: 'Redirect',
            redirect: '/health/home'
        },
        {
            path: '/health',
            name: 'Health',
            component: () => import("@/view/health/Index.vue"),
            children: [
                {
                    path: 'home',
                    name: 'Home',
                    component: () => import('@/view/health/Home.vue')
                },
                {
                    path: 'subscribe',
                    name: 'Subscribe',
                    component: () => import('@/view/health/Subscribe.vue')
                },
                {
                    path: 'model',
                    name: 'Model',
                    component: () => import('@/view/health/MyModel.vue')
                },
                {
                    path: 'record',
                    name: 'Record',
                    component: () => import('@/view/health/Record.vue')
                },
                {
                    path: 'search',
                    name: 'Search',
                    component: () => import('@/view/health/Search.vue')
                },
                {
                    path: 'notice',
                    name: 'Notice',
                    component: () => import('@/view/health/Notice.vue')
                },
                {
                    path: 'admin',
                    name: 'Admin',
                    component: () => import('@/view/admin/index.vue'),
                    children:[
                        {
                            path: 'homePage',
                            name: 'HomePage',
                            component: () => import('@/view/admin/HomePage.vue')
                        },
                        {
                            path: 'userManage',
                            name: 'UserManage',
                            component: () => import('@/view/admin/UserManage.vue')
                        },
                        {
                            path: 'dictManage',
                            name: 'DictManage',
                            component: () => import('@/view/admin/DictManage.vue')
                        },
                        {
                            path: 'articleManage',
                            name: 'ArticleManage',
                            component: () => import('@/view/admin/ArticleManage.vue')
                        },
                        {
                            path: 'commentManage',
                            name: 'CommentManage',
                            component: () => import('@/view/admin/CommentManage.vue')
                        },
                        {
                            path: 'modelManage',
                            name: 'ModelManage',
                            component: () => import('@/view/admin/ModelManage.vue')
                        },
                        {
                            path: 'noticeManage',
                            name: 'NoticeManage',
                            component: () => import('@/view/admin/NoticeManage.vue')
                        }
                    ]
                },
                {
                    path: 'personage',
                    name: 'Personage',
                    component: () => import('@/view/person/Personage.vue'),
                    children:
                        [
                            {
                                path: 'myInfo',
                                name: 'MyInfo',
                                component: () => import('@/view/person/MyInfo.vue')
                            },
                            {
                                path: 'myArticles',
                                name: 'MyArticles',
                                component: () => import('@/view/person/MyArticles.vue')
                            },
                            {
                                path: 'updatePsw',
                                name: 'UpdatePsw',
                                component: () => import('@/view/person/UpdatePsw.vue')
                            },
                            {
                                path:'addArticle',
                                name:'AddArticle',
                                component:()=>import('@/view/person/CreateArticle.vue')
                            }

                        ]
                },
                {
                    path:'article/:id',
                    name:'Article',
                    component:()=>import('@/view/health/Article.vue')
                },
                {
                    path:'error',
                    name:'Error',
                    component:()=>import('@/view/health/Error.vue')
                },
            ]
        },
        {
            path: '/login',
            name: 'Login',
            component: () => import('@/view/login/Login.vue')
        },
        {
            path:'/ai',
            name:'AI',
            component:()=>import('@/view/chatAi/index.vue')
        },
        {
            path:'/test',
            name:'Test',
            component:()=>import('@/view/Test.vue')
        }
    ]
})

export default router;